#ifndef _CCSLOTTRANSFORM_H_
#define _CCSLOTTRANSFORM_H_

#include "CCTransform.h"

NS_CC_BEGIN

class CCSlot;

/**
 * transform of slot, it records key frames of one slot
 */
class CCSlotTransform : public CCTransform {
public:
	/// key frame of slot skin attachment
	struct SkinKeyFrame : public KeyFrame {
		/// skin attachment name
		const char* attachmentName;
	};
	
	/// key frame of slot color
	struct ColorKeyFrame : public KeyFrame {
		/// color in argb format
        ccColor4B color;
	};
	
private:
	/// current slot image
	SkinKeyFrame m_currentSkin;
	
	/// current slot color
	ColorKeyFrame m_currentColor;
	
	/// key frame of slot skin
	typedef vector<SkinKeyFrame> SkinKeyFrameList;
	SkinKeyFrameList m_skfList;
	
	/// key frame of slot color
	typedef vector<ColorKeyFrame> ColorKeyFrameList;
	ColorKeyFrameList m_ckfList;
    
    CCSlot* m_slot;
	
protected:
	CCSlotTransform();
    CCSlotTransform(CCSlot* slot);
	
public:
	virtual ~CCSlotTransform();
	static CCSlotTransform* create(CCSlot* slot);
	
	virtual void populateFrame(float time, float deltaTime);
	
	virtual void applyTo(CCSkeletalSprite* owner,float alpha=1);
    
	/// add slot skin key frame, the skin name will not be copied, so caller
	/// should NOT release the original one after returns
	void addSkinKeyFrame(const SkinKeyFrame& kf);
	
	/// add slot color key frame
	void addColorKeyFrame(const ColorKeyFrame& kf);
	
	/// get slot skin frame
	SkinKeyFrame& getSkinFrame() { return m_currentSkin; }
	
	/// get slot color frame
	ColorKeyFrame& getColorFrame() { return m_currentColor; }
    
};

NS_CC_END

#endif // __CCSlotTransform_h__
